package Exercise;
//获取二个字符串内容乘积的结果，并以字符串的形式返回
public class String_11 {
    public static void main(String[] args) {
        String num1 = "111";
        String num2 = "3";
        //将字符串变成数字
        int n1 = Work_tr(num1);
        int n2 = Work_tr(num2);
        //将数字相乘，再转换为字符串的形式输出
        int n3 = n1 * n2;
        System.out.println(""+n3);

    }
    //变为数字
    public static int Work_tr(String num){
        int result = 0;  //存放取出字符串的内容
        for (int i = 0; i <num.length() ; i++) {
            //累加
            result = result * 10 + num.charAt(i)-'0';
        }
        return result;
    }
}
